home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / src / GLperf3.12-src.lha / GLperf / Tex.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-01  |  13.8 KB  |  492 lines

  1. /*
  2.  * (c) Copyright 1995, Silicon Graphics, Inc.
  3.  * ALL RIGHTS RESERVED
  4.  * Permission to use, copy, modify, and distribute this software for
  5.  * any purpose and without fee is hereby granted, provided that the above
  6.  * copyright notice appear in all copies and that both the copyright notice
  7.  * and this permission notice appear in supporting documentation, and that
  8.  * the name of Silicon Graphics, Inc. not be used in advertising
  9.  * or publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.
  11.  *
  12.  * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
  13.  * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
  14.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
  15.  * FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL SILICON
  16.  * GRAPHICS, INC.  BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
  17.  * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
  18.  * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
  19.  * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
  20.  * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC.  HAS BEEN
  21.  * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
  22.  * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
  23.  * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
  24.  *
  25.  * US Government Users Restricted Rights
  26.  * Use, duplication, or disclosure by the Government is subject to
  27.  * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
  28.  * (c)(1)(ii) of the Rights in Technical Data and Computer Software
  29.  * clause at DFARS 252.227-7013 and/or in similar or successor
  30.  * clauses in the FAR or the DOD or NASA FAR Supplement.
  31.  * Unpublished-- rights reserved under the copyright laws of the
  32.  * United States.  Contractor/manufacturer is Silicon Graphics,
  33.  * Inc., 2011 N.  Shoreline Blvd., Mountain View, CA 94039-7311.
  34.  *
  35.  * Author: John Spitzer, SGI Applied Engineering
  36.  *
  37.  */
  38.  
  39. #if (defined(INC_REASON)) && (INC_REASON == INFO_ITEM_STRUCT)
  40. #include "Test.h"
  41.     int imageDepth;
  42.     int imageExtent;
  43.     int texImageWidth;
  44.     int texImageHeight;
  45.     int texImageDepth;
  46.     int texImageExtent;
  47.     int texTarget;
  48.     int texComps;
  49.     int texBorder;
  50.     int texLevel;
  51.     int texImageSrc;
  52.     int texMipmap;
  53.     int drawOrder;
  54.     int objDraw;
  55. #ifdef GL_EXT_subtexture
  56.     int subTexWidth;
  57.     int subTexHeight;
  58.     int subTexDepth;
  59.     int subTexExtent;
  60. #endif
  61. #ifdef GL_EXT_copy_texture
  62.     int copyTexWidth;
  63.     int copyTexHeight;
  64. #endif
  65. #ifdef GL_EXT_texture_object
  66.     int residentTexObjs;
  67. #endif
  68. #ifdef GL_SGIS_texture_lod
  69.     int texBaseLevel;
  70.     int texMaxLevel;
  71. #endif
  72.     /* Variables below this line aren't user settable */
  73.     void **imageData;
  74.     int numDrawn;
  75.     int texDim;
  76.     int subImage;
  77.     GLint *subImageData;
  78.     int subTexOrImage;
  79. #ifdef GL_EXT_subtexture
  80.     int subTexture;
  81.     GLint *subTexData;
  82. #endif
  83. #ifdef GL_EXT_copy_texture
  84.     GLint *copyTexData;
  85. #endif
  86. #ifdef GL_EXT_texture_object
  87.     GLuint *texObjs;
  88. #endif
  89.     GLfloat *triangleData;
  90.     int mipmapLevels;
  91.     void*** mipmapData;
  92.     GLint *mipmapDimData;
  93.     GLuint dlBase;
  94.     /* Member functions */
  95.     /* void Initialize(TestPtr); */               /* virtual function */
  96.     /* void Cleanup(TestPtr); */                  /* virtual function */
  97.     /* void Execute(TestPtr);   */                /* virtual function */
  98.     /* int SetState(TestPtr);  */                 /* virtual function */
  99.     /* float PixelSize(TestPtr);  */              /* virtual function */
  100.     /* int TimesRun(TestPtr);  */                 /* virtual function */
  101.     /* void (*SetExecuteFunc)(TestPtr); */        /* virtual function */
  102.     Image image_TexImage;
  103.     TransferMap transfermap_TexImage;
  104. #elif (defined(INC_REASON)) && (INC_REASON == INFO_ITEM_ARRAY)
  105. #include "Test.h"
  106. #undef offset
  107. #define offset(v) offsetof(TexImage,transfermap_TexImage)+offsetof(TransferMap, v)
  108. #include "TransMap.h"
  109. #undef offset
  110. #define offset(v) offsetof(TexImage, image_TexImage)+offsetof(Image, v)
  111. #include "Image.h"
  112. #undef offset
  113. #define offset(v) offsetof(TexImage,v)
  114. #ifdef GL_EXT_texture3D
  115.     {
  116.         ImageDepth,
  117.         "Image Depth",
  118.         offset(imageDepth),
  119.         RangedInteger,
  120.         {
  121.             { 1 },
  122.             { 2048 }
  123.         },
  124.         { 1 }
  125.     },
  126. #endif
  127. #ifdef GL_SGIS_texture4D
  128.     {
  129.         ImageExtent,
  130.         "Image Extent",
  131.         offset(imageExtent),
  132.         RangedInteger,
  133.         {
  134.             { 1 },
  135.             { 2048 }
  136.         },
  137.         { 1 }
  138.     },
  139. #endif
  140.     {
  141.         TexImageTarget,
  142.         "TexImage Target",
  143.         offset(texTarget),
  144.         Enumerated,
  145.         {
  146.             { GL_TEXTURE_1D,        "GL_TEXTURE_1D" },
  147.             { GL_TEXTURE_2D,        "GL_TEXTURE_2D" },
  148. #ifdef GL_SGIS_detail_texture
  149.             { GL_DETAIL_TEXTURE_2D_SGIS,"GL_DETAIL_TEXTURE_2D_SGIS" },
  150. #endif
  151. #ifdef GL_EXT_texture3D
  152.             { GL_TEXTURE_3D_EXT,    "GL_TEXTURE_3D_EXT" },
  153. #endif
  154. #ifdef GL_SGIS_texture4D
  155.             { GL_TEXTURE_4D_SGIS,    "GL_TEXTURE_4D_SGIS" },
  156. #endif
  157.             { End }
  158.         },
  159.         { GL_TEXTURE_2D }
  160.     },
  161.     {
  162.         TexImageWidth,
  163.         "Width of TexImage",
  164.         offset(texImageWidth),
  165.         RangedInteger,
  166.         {
  167.             { 1 },
  168.             { 2048 },
  169.         },
  170.         { -1 }
  171.     },
  172.     {
  173.         TexImageHeight,
  174.         "Height of TexImage",
  175.         offset(texImageHeight),
  176.         RangedInteger,
  177.         {
  178.             { 1 },
  179.             { 2048 },
  180.         },
  181.         { -1 }
  182.     },
  183. #ifdef GL_EXT_texture3D
  184.     {
  185.         TexImageDepth,
  186.         "Depth of TexImage",
  187.         offset(texImageDepth),
  188.         RangedInteger,
  189.         {
  190.             { 1 },
  191.             { 2048 },
  192.         },
  193.         { -1 }
  194.     },
  195. #endif
  196. #ifdef GL_SGIS_texture4D
  197.     {
  198.         TexImageExtent,
  199.         "Extent of TexImage",
  200.         offset(texImageExtent),
  201.         RangedInteger,
  202.         {
  203.             { 1 },
  204.             { 2048 },
  205.         },
  206.         { -1 }
  207.     },
  208. #endif
  209.     {
  210.         TexImageComps,
  211.         "TexImage Ccmponents",
  212.         offset(texComps),
  213.         Enumerated,
  214.         {
  215.             { 1,        "1" },
  216.             { 2,        "2" },
  217.             { 3,        "3" },
  218.             { 4,        "4" },
  219. #ifdef GL_EXT_texture
  220.             { GL_ALPHA,            "GL_ALPHA" },
  221.             { GL_ALPHA4_EXT,        "GL_ALPHA4_EXT" },
  222.             { GL_ALPHA8_EXT,        "GL_ALPHA8_EXT" },
  223.             { GL_ALPHA12_EXT,        "GL_ALPHA12_EXT" },
  224.             { GL_ALPHA16_EXT,        "GL_ALPHA16_EXT" },
  225.             { GL_LUMINANCE,        "GL_LUMINANCE" },
  226.             { GL_LUMINANCE4_EXT,    "GL_LUMINANCE4_EXT" },
  227.             { GL_LUMINANCE8_EXT,    "GL_LUMINANCE8_EXT" },
  228.             { GL_LUMINANCE12_EXT,    "GL_LUMINANCE12_EXT" },
  229.             { GL_LUMINANCE16_EXT,    "GL_LUMINANCE16_EXT" },
  230.             { GL_LUMINANCE_ALPHA,    "GL_LUMINANCE_ALPHA" },
  231.             { GL_LUMINANCE4_ALPHA4_EXT,    "GL_LUMINANCE4_ALPHA4_EXT" },
  232.             { GL_LUMINANCE6_ALPHA2_EXT,    "GL_LUMINANCE6_ALPHA2_EXT" },
  233.             { GL_LUMINANCE8_ALPHA8_EXT,    "GL_LUMINANCE8_ALPHA8_EXT" },
  234.             { GL_LUMINANCE12_ALPHA4_EXT,"GL_LUMINANCE12_ALPHA4_EXT" },
  235.             { GL_LUMINANCE12_ALPHA12_EXT,"GL_LUMINANCE12_ALPHA12_EXT" },
  236.             { GL_LUMINANCE16_ALPHA16_EXT,"GL_LUMINANCE16_ALPHA16_EXT" },
  237.             { GL_INTENSITY_EXT,        "GL_INTENSITY_EXT" },
  238.             { GL_INTENSITY4_EXT,    "GL_INTENSITY4_EXT" },
  239.             { GL_INTENSITY8_EXT,    "GL_INTENSITY8_EXT" },
  240.             { GL_INTENSITY12_EXT,    "GL_INTENSITY12_EXT" },
  241.             { GL_INTENSITY16_EXT,    "GL_INTENSITY16_EXT" },
  242.             { GL_RGB,            "GL_RGB" },
  243.             { GL_RGB2_EXT,        "GL_RGB2_EXT" },
  244.             { GL_RGB4_EXT,        "GL_RGB4_EXT" },
  245.             { GL_RGB5_EXT,        "GL_RGB5_EXT" },
  246.             { GL_RGB5_A1_EXT,        "GL_RGB5_A1_EXT" },
  247.             { GL_RGB8_EXT,        "GL_RGB8_EXT" },
  248.             { GL_RGB10_EXT,        "GL_RGB10_EXT" },
  249.             { GL_RGB10_A2_EXT,        "GL_RGB10_A2_EXT" },
  250.             { GL_RGB12_EXT,        "GL_RGB12_EXT" },
  251.             { GL_RGB16_EXT,        "GL_RGB16_EXT" },
  252.             { GL_RGBA,            "GL_RGBA" },
  253.             { GL_RGBA2_EXT,        "GL_RGBA2_EXT" },
  254.             { GL_RGBA4_EXT,        "GL_RGBA4_EXT" },
  255.             { GL_RGBA8_EXT,        "GL_RGBA8_EXT" },
  256.             { GL_RGBA12_EXT,        "GL_RGBA12_EXT" },
  257.             { GL_RGBA16_EXT,        "GL_RGBA16_EXT" },
  258. #endif
  259. #ifdef GL_SGIS_texture_select
  260.             { GL_DUAL_ALPHA4_SGIS,        "GL_DUAL_ALPHA4_SGIS" },
  261.             { GL_DUAL_ALPHA8_SGIS,        "GL_DUAL_ALPHA8_SGIS" },
  262.             { GL_DUAL_ALPHA12_SGIS,        "GL_DUAL_ALPHA12_SGIS" },
  263.             { GL_DUAL_ALPHA16_SGIS,        "GL_DUAL_ALPHA16_SGIS" },
  264.             { GL_DUAL_LUMINANCE4_SGIS,        "GL_DUAL_LUMINANCE4_SGIS" },
  265.             { GL_DUAL_LUMINANCE8_SGIS,        "GL_DUAL_LUMINANCE8_SGIS" },
  266.             { GL_DUAL_LUMINANCE12_SGIS,        "GL_DUAL_LUMINANCE12_SGIS" },
  267.             { GL_DUAL_LUMINANCE16_SGIS,        "GL_DUAL_LUMINANCE16_SGIS" },
  268.             { GL_DUAL_INTENSITY4_SGIS,        "GL_DUAL_INTENSITY4_SGIS" },
  269.             { GL_DUAL_INTENSITY8_SGIS,        "GL_DUAL_INTENSITY8_SGIS" },
  270.             { GL_DUAL_INTENSITY12_SGIS,        "GL_DUAL_INTENSITY12_SGIS" },
  271.             { GL_DUAL_INTENSITY16_SGIS,        "GL_DUAL_INTENSITY16_SGIS" },
  272.             { GL_DUAL_LUMINANCE_ALPHA4_SGIS,    "GL_DUAL_LUMINANCE_ALPHA4_SGIS" },
  273.             { GL_DUAL_LUMINANCE_ALPHA8_SGIS,    "GL_DUAL_LUMINANCE_ALPHA8_SGIS" },
  274.             { GL_QUAD_ALPHA4_SGIS,        "GL_QUAD_ALPHA4_SGIS" },
  275.             { GL_QUAD_ALPHA8_SGIS,        "GL_QUAD_ALPHA8_SGIS" },
  276.             { GL_QUAD_LUMINANCE4_SGIS,        "GL_QUAD_LUMINANCE4_SGIS" },
  277.             { GL_QUAD_LUMINANCE8_SGIS,        "GL_QUAD_LUMINANCE8_SGIS" },
  278.             { GL_QUAD_INTENSITY4_SGIS,        "GL_QUAD_INTENSITY4_SGIS" },
  279.             { GL_QUAD_INTENSITY8_SGIS,        "GL_QUAD_INTENSITY8_SGIS" },
  280. #endif
  281.             { End }
  282.         },
  283.         { 3 }
  284.     },
  285.     {
  286.         TexImageBorder,
  287.         "Border of TexImage",
  288.         offset(texBorder),
  289.         RangedInteger,
  290.         {
  291.             { 0 },
  292. #ifdef GL_SGIS_texture_filter4
  293.             { 2 },
  294. #else
  295.             { 1 },
  296. #endif
  297.         },
  298.         { 0 }
  299.     },
  300. #ifdef GL_EXT_subtexture
  301.     {
  302.         SubTexImageWidth,
  303.         "Width of SubTexImage",
  304.         offset(subTexWidth),
  305.         RangedInteger,
  306.         {
  307.             { 1 },
  308.             { 2048 },
  309.         },
  310.         { -1 }
  311.     },
  312.     {
  313.         SubTexImageHeight,
  314.         "Height of SubTexImage",
  315.         offset(subTexHeight),
  316.         RangedInteger,
  317.         {
  318.             { 1 },
  319.             { 2048 },
  320.         },
  321.         { -1 }
  322.     },
  323.  #ifdef GL_EXT_texture3D
  324.     {
  325.         SubTexImageDepth,
  326.         "Depth of SubTexImage",
  327.         offset(subTexDepth),
  328.         RangedInteger,
  329.         {
  330.             { 1 },
  331.             { 2048 },
  332.         },
  333.         { -1 }
  334.     },
  335.  #endif
  336. #endif
  337. #ifdef GL_EXT_texture_object
  338.     {
  339.         ResidentTexObjs,
  340.         "Number of Resident Texture Objects",
  341.         offset(residentTexObjs),
  342.         RangedInteger | NotSettable,
  343.         {
  344.             { 1 },
  345.             { 1024 },
  346.         },
  347.         { -1 }
  348.     },
  349. #endif
  350.     {
  351.         TexImageSrc,
  352.         "Source of Texture Image",
  353.         offset(texImageSrc),
  354.         Enumerated,
  355.         {
  356.             { SystemMemory,                   "SystemMemory" },
  357.             { DisplayList,                    "DisplayList" },
  358. #ifdef GL_EXT_texture_object
  359.             { TexObj,                         "TexObj" },
  360. #endif
  361. #ifdef GL_EXT_copy_texture
  362.             { Framebuffer,                    "Framebuffer" },
  363. #endif
  364.             { End }
  365.         },
  366.         { SystemMemory }
  367.     },
  368.     {
  369.         TexImageLevel,
  370.         "Texture Image Level",
  371.         offset(texLevel),
  372.         RangedInteger,
  373.         {
  374.             { 0 },
  375.             { 31 },
  376.         },
  377.         { 0 }
  378.     },
  379. #ifdef GL_SGIS_texture_lod
  380.     {
  381.         TexImageBaseLevel,
  382.         "Base Texture Image Level",
  383.         offset(texBaseLevel),
  384.         RangedInteger,
  385.         {
  386.             { 0 },
  387.             { 31 },
  388.         },
  389.         { 0 }
  390.     },
  391.     {
  392.         TexImageMaximumLevel,
  393.         "Maximum Texture Image Level",
  394.         offset(texMaxLevel),
  395.         RangedInteger,
  396.         {
  397.             { 0 },
  398.             { 31 },
  399.         },
  400.         { -1 }
  401.     },
  402. #endif
  403.     {
  404.         TexImageMipmap,
  405.         "Method of Calculating Mipmaps",
  406.         offset(texMipmap),
  407.         Enumerated,
  408.         {
  409.             { None,                           "None" },
  410.             { PreCalculate,                   "PreCalculate" },
  411.             { gluBuildMipmap,                 "gluBuildMipmap" },
  412. #ifdef GL_SGIS_generate_mipmap
  413.             { GenerateMipmapExt,              "GenerateMipmapExt" },
  414. #endif
  415.             { End }
  416.         },
  417.         { None }
  418.     },
  419.     {
  420.         ObjDraw,
  421.         "Object Drawn Between TexImage Loads",
  422.         offset(objDraw),
  423.         Enumerated,
  424.         {
  425.             { None,                 "None" },
  426.             { TexturedPoint,        "TexturedPoint" },
  427.             { TexturedTriangle,     "TexturedTriangle" },
  428.             { End }
  429.         },
  430.         { None }
  431.     },
  432.     {
  433.         DrawOrder,
  434.         "Order in which TexImage sections are Drawn",
  435.         offset(drawOrder),
  436.         Enumerated,
  437.         {
  438.             { Serial,            "Serial" },
  439.             { Spaced,            "Spaced" },
  440.             { End }
  441.         },
  442.         { Spaced }
  443.     },
  444.     {
  445.         0
  446.     }
  447.  
  448. #else  /* INC_REASON not defined, treat as plain include */
  449. #ifndef _Tex_h
  450. #define _Tex_h
  451.  
  452. #include "RastrPos.h"
  453. #include "Image.h"
  454. #include "TransMap.h"
  455. #include "General.h"
  456. #include "TestName.h"
  457. #include "PropName.h"
  458. #include "Global.h"
  459. #include "AttrName.h"
  460. #ifdef WIN32
  461. #include <windows.h>
  462. #endif
  463. #include <GL/gl.h>
  464. #include <GL/glu.h>
  465. #include "Random.h"
  466. #include "FuncEnum.h"
  467.  
  468. typedef struct _TexImage {
  469. #define INC_REASON INFO_ITEM_STRUCT
  470. #include "Tex.h"
  471. #undef INC_REASON
  472. } TexImage, *TexImagePtr;
  473.  
  474. TexImagePtr new_TexImage();
  475. void delete_TexImage(TestPtr);
  476. void TexImage__AddTraversalData(TexImagePtr);
  477. int TexImage__SetState(TestPtr);
  478. void TexImage__Initialize(TestPtr);
  479. void TexImage__Cleanup(TestPtr);
  480. void TexImage__SetExecuteFunc(TestPtr);
  481. TestPtr TexImage__Copy(TestPtr);
  482. float TexImage__Size(TestPtr);
  483. int TexImage__TimesRun(TestPtr);
  484. void TexImage__CreateImageData(TexImagePtr);
  485.  
  486. /* These constants are used in the function enumeration scheme */
  487. #define DISPLAY_LIST 0
  488. #define TEXTURE_OBJ 1
  489.  
  490. #endif /* file not already included */
  491. #endif /* INC_REASON not defined */
  492.